/**
 * reducer 状态管理员
 */

export interface IFState {
    content: string;
}

export type ActionType = 'A' | 'B' | 'C'

export interface IFAction {
    type: ActionType;
    content: string;
}


const defaultState: IFState = {
    content: ''
}

export default (state: IFState = defaultState, action: IFAction) => {
    const { content, type } = action
    switch (type) {
        case 'A': return { content: '' };
        case 'B':
        case 'C':
            return { content };
        default:
            return state
    }
}